'*******************************************************************************
' *  
' *  Product: GSALib
' *  Description: A C# API for accessing the Google Search Appliance.
' *
' *  (c) Copyright 2008 Michael Cizmar + Associates Ltd.  (MC+A)
' *  
'*******************************************************************************


Imports System
Imports System.Collections.Generic
Imports System.Text

Namespace GSALib.Constants
    ''' <summary>
    ''' Class provides Filtering options in search results supported by GSA
    ''' <para>Author Albert Ghukasyan</para>    
    ''' </summary>
    Public NotInheritable Class Filtering
#Region "Variables"

        ''' <summary>
        ''' No Filter
        ''' </summary>
        Public Shared NO_FILTER As New Filtering("0"c)

        ''' <summary>
        ''' "Duplicate directory" and "Duplicate snippet" filtering 
        ''' </summary>
        Public Shared FULL_FILTER As New Filtering("1"c)

        ''' <summary>
        ''' "Duplicate snippet" filtering 
        ''' </summary>
        Public Shared DUPLICATE_SNIPPET_FILTER As New Filtering("s"c)

        ''' <summary>
        ''' "Duplicate directory" filtering 
        ''' </summary>      
        Public Shared DUPLICATE_DIRECTORY_FILTER As New Filtering("p"c)

        Private value As Char

#End Region

#Region "Constructor"

        Private Sub New(ByVal value As Char)
            Me.value = value
        End Sub

#End Region

#Region "Methods"

        Public Function hashCode() As Integer
            Return Val(value)
        End Function

        Public Function equals(ByVal o As Object) As Boolean
            Dim retval As Boolean = False
            If o IsNot Nothing AndAlso TypeOf o Is Filtering Then
                Dim other As Filtering = DirectCast(o, Filtering)
                retval = other.value = Me.value
            End If
            Return retval
        End Function

        Public Function getValue() As Char
            Return value
        End Function

#End Region
    End Class
End Namespace
